{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}G:\My Drive\Replications\Schwander\Log_Analysis_Schwander_PSRM.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}22 Feb 2019, 10:22:00
{txt}
{com}. 
. **********************************************************************************************************
. * Replication Code
. * The spread of labor market vulnerability into the middle class
. * Hanna Schwander
. * Political Science Research and Methods
. **********************************************************************************************************
. 
. * This script replicates the empirical results (tables and figures) based on the Labour Force Survey (LFS) 1992-2015
. * The generation of the relevant variables is decribed in an additional file ("create_LSF_pooled.do").
. 
. * The script relies on the package grc1leg which needs first to be installed by typing "net install grc1leg" into stata
. 
. ********************************************
. * 1. LOAD DATA
. ********************************************
. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. ********************************************
. * 2. Figure in main text
. ********************************************
. 
. * FIGURE 1: The spread of part-time employment and temporary employment risks to the middle class
. 
. collapse (mean) m_tempinv = tempinv       m_part = parttime, by(year) 
{txt}
{com}. save "means_1992-2015.dta", replace
{txt}(note: file means_1992-2015.dta not found)
file means_1992-2015.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_tempinv = tempinv m_part = parttime if education ==3, by(year)
{txt}
{com}. rename m_tempinv hs_tempinv
{res}{txt}
{com}. rename m_part hs_part 
{res}{txt}
{com}. save "hsmeans_1992-2015.dta", replace
{txt}(note: file hsmeans_1992-2015.dta not found)
file hsmeans_1992-2015.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_tempinv = tempinv m_part = parttime if hswomen==1, by(year)
{txt}
{com}. rename m_tempinv hswomen_tempinv
{res}{txt}
{com}. rename m_part hswomen_part 
{res}{txt}
{com}. 
. save "hswmeans_1992-2015.dta", replace
{txt}(note: file hswmeans_1992-2015.dta not found)
file hswmeans_1992-2015.dta saved

{com}. 
. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_tempinv = tempinv m_part = parttime if hsyoung==1, by(year)
{txt}
{com}. rename m_tempinv hsyoung_tempinv
{res}{txt}
{com}. rename m_part hsyoung_part 
{res}{txt}
{com}. 
. 
. merge 1:1 year using "means_1992-2015.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}              24{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. merge 1:1 year using "hsmeans_1992-2015.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}              24{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. merge 1:1 year using "hswmeans_1992-2015.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}              24{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge 
{txt}
{com}. 
. save "allmeans_1992-2015.dta", replace
{txt}(note: file allmeans_1992-2015.dta not found)
file allmeans_1992-2015.dta saved

{com}. 
. 
. tsset year
{res}{txt}{col 9}time variable:  {res}{col 25}year, 1992 to 2015
{txt}{col 17}delta:  {res}1 unit
{txt}
{com}. tssmooth ma smooth_part=m_part, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= m_part{p_end}
{txt}
{com}. tssmooth ma smooth_tempinv=m_tempinv, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= m_tempinv{p_end}
{txt}
{com}. tssmooth ma smooth_hspart=hs_part, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hs_part{p_end}
{txt}
{com}. tssmooth ma smooth_hstempinv=hs_tempinv, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hs_tempinv{p_end}
{txt}
{com}. tssmooth ma smooth_hswomenpart=hswomen_part, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hswomen_part{p_end}
{txt}
{com}. tssmooth ma smooth_hswomentempinv=hswomen_tempinv, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hswomen_tempinv{p_end}
{txt}
{com}. tssmooth ma smooth_hsyoungpart=hsyoung_part, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hsyoung_part{p_end}
{txt}
{com}. tssmooth ma smooth_hsyoungtempinv=hsyoung_tempinv, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hsyoung_tempinv{p_end}
{txt}
{com}. 
. gen part =smooth_part*100
{txt}
{com}. gen hspart =smooth_hspart*100
{txt}
{com}. gen hswomenpart =smooth_hswomenpart*100
{txt}
{com}. gen hsyoungpart =smooth_hsyoungpart*100
{txt}
{com}. gen temp =smooth_temp*100
{txt}
{com}. gen hstemp =smooth_hstemp*100
{txt}
{com}. gen hswomentemp =smooth_hswomentemp*100
{txt}
{com}. gen hsyoungtemp =smooth_hsyoungtemp*100
{txt}
{com}. 
. 
. la var part "Workforce"
{txt}
{com}. la var temp "Workforce"
{txt}
{com}. la var hspart "High-skilled"
{txt}
{com}. la var hstemp "High-skilled"
{txt}
{com}. la var hswomenpart "High-skilled women"
{txt}
{com}. la var hswomentemp "High-skilled women"
{txt}
{com}. la var hsyoungpart "High-skilled young adults"
{txt}
{com}. la var hsyoungtemp "High-skilled young adults"
{txt}
{com}. 
. 
. * Parttime employment           
. twoway line part year  || ///
>                 line hsyoungpart year  || ///
>                 line hswomenpart year  ||, ///                          
>                 legend( size(small) margin(zero) region(lpattern(blank)) bmargin(tiny) pos(6) row(2)) ///
>                 ytitle("% of total employment", size(medsmall) margin(zero)) ylabel(0(5)30, labsize(small)) /// 
>                 title("Part-time employment") xtitle("") xlabel(1990(5)2015, labsize(medsmall)) saving(part, replace) ///
>                 graphregion(fcolor(white)) scheme(lean2) aspectratio(0.8)
{txt}(note: scheme lean2 not found, using s2color)
{res}{txt}(note: file part.gph not found)
{res}{txt}(file part.gph saved)

{com}. 
. * Temporary employment          
. twoway line temp year  || ///
>                 line hsyoungtemp year  || ///
>                 line hswomentemp year  ||, ///
>                 legend( size(small) margin(zero) region(lpattern(blank)) bmargin(tiny) pos(6) row(2)) ///
>                 ytitle("", size(medsmall) margin(zero)) ylabel(0(5)30, labsize(small)) /// 
>                 title("Temporary employment") xtitle("") xlabel(1990(5)2015, labsize(medsmall))saving(temp, replace) ///
>                 graphregion(fcolor(white)) scheme(lean2) aspectratio(0.8)
{txt}(note: scheme lean2 not found, using s2color)
{res}{txt}(note: file temp.gph not found)
{res}{txt}(file temp.gph saved)

{com}. 
.                 
. *** Add the two graphs to Figure 1      
.         grc1leg "part" "temp", graphregion(fcolor(white))
{res}{txt}
{com}.         graph export "Fig_1_spread in the MC.eps", as(eps) replace
{txt}(note: file Fig_1_spread in the MC.eps not found)
(file Fig_1_spread in the MC.eps written in EPS format)

{com}. 
. 
.         
. *******************************************************************************************************************************
. ** 3. FIGURES IN THE APPENDIX
. *******************************************************************************************************************************
. 
. *** Figure A.1: The spread of unemployment risk to the middle class in Western Europe
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_unempl = unempl       , by(year) 
{txt}
{com}. save "umeans_1992-2015.dta", replace
{txt}(note: file umeans_1992-2015.dta not found)
file umeans_1992-2015.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_unempl = unempl if education ==3, by(year)
{txt}
{com}. rename m_unempl hs_unempl
{res}{txt}
{com}. save "uhsmeans_1992-2015.dta", replace
{txt}(note: file uhsmeans_1992-2015.dta not found)
file uhsmeans_1992-2015.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse(mean) m_unempl = unempl if hswomen==1, by(year)
{txt}
{com}. rename m_unempl hswomen_unempl
{res}{txt}
{com}. save "uhswmeans_1992-2015.dta", replace
{txt}(note: file uhswmeans_1992-2015.dta not found)
file uhswmeans_1992-2015.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_unempl = unempl if hsyoung==1, by(year)
{txt}
{com}. rename m_unempl hsyoung_unempl
{res}{txt}
{com}. save "uhsymeans_1992-2015.dta", replace
{txt}(note: file uhsymeans_1992-2015.dta not found)
file uhsymeans_1992-2015.dta saved

{com}. 
. 
. use "umeans_1992-2015.dta", clear
{txt}
{com}. 
. merge 1:1 year using "uhsmeans_1992-2015.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}              24{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. merge 1:1 year using "uhswmeans_1992-2015.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}              24{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge 
{txt}
{com}. merge 1:1 year using "uhsymeans_1992-2015.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}              24{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. 
. save "UNallmeans_1992-2015.dta", replace
{txt}(note: file UNallmeans_1992-2015.dta not found)
file UNallmeans_1992-2015.dta saved

{com}. 
. 
. tsset year
{res}{txt}{col 9}time variable:  {res}{col 25}year, 1992 to 2015
{txt}{col 17}delta:  {res}1 unit
{txt}
{com}. tssmooth ma smooth_unempl=m_unempl, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= m_unempl{p_end}
{txt}
{com}. tssmooth ma smooth_hsunempl=hs_unempl, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hs_unempl{p_end}
{txt}
{com}. tssmooth ma smooth_hswomenunempl=hswomen_unempl, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hswomen_unempl{p_end}
{txt}
{com}. tssmooth ma smooth_hsyoungunempl=hsyoung_unempl, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5}(1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hsyoung_unempl{p_end}
{txt}
{com}. 
. gen unempl =smooth_unempl*100
{txt}
{com}. gen hsunempl =smooth_hsunempl*100
{txt}
{com}. gen hswomenunempl =smooth_hswomenunempl*100
{txt}
{com}. gen hsyoungunempl =smooth_hsyoungunempl*100
{txt}
{com}. 
. la var unempl "Workforce"
{txt}
{com}. la var hsunempl "High-skilled"
{txt}
{com}. la var hswomenunempl "High-skilled women"
{txt}
{com}. la var hsyoungunempl "High-skilled young adults"
{txt}
{com}. 
. 
. 
. twoway line unempl year  || ///
>                 line hsyoungunempl year  || ///
>                 line hswomenunempl year  ||, ///
>                 legend( size(small) margin(zero) region(lpattern(blank))  pos(4) row(3)) ///
>                 ytitle("% of total employment", size(medsmall) margin(zero)) ylabel(0(5)15, labsize(medsmall)) /// 
>                 title("Unemployment") xtitle("") xlabel(1990(5)2015, labsize(medsmall))  ///
>                 graphregion(fcolor(white)) scheme(lean2) aspectratio(1)
{txt}(note: scheme lean2 not found, using s2color)
{res}{txt}
{com}. graph export "Fig_A1_spread in the MC_UNEMPL.eps", as(eps) replace
{txt}(note: file Fig_A1_spread in the MC_UNEMPL.eps not found)
(file Fig_A1_spread in the MC_UNEMPL.eps written in EPS format)

{com}.                 
.                 
. 
. *** Figure A.2/A.3: The spread of part-time / temporary employment risks to the middle class, per country
. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_tempinv = tempinv       m_part = parttime, by(year country) 
{txt}
{com}. save "means_1992-2015CN.dta", replace
{txt}(note: file means_1992-2015CN.dta not found)
file means_1992-2015CN.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_tempinv = tempinv m_part = parttime if education ==3, by(year country)
{txt}
{com}. rename m_tempinv hs_tempinv
{res}{txt}
{com}. rename m_part hs_part 
{res}{txt}
{com}. save "hsmeans_1992-2015CN.dta", replace
{txt}(note: file hsmeans_1992-2015CN.dta not found)
file hsmeans_1992-2015CN.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_tempinv = tempinv m_part = parttime if hswomen==1, by(year country)
{txt}
{com}. rename m_tempinv hswomen_tempinv
{res}{txt}
{com}. rename m_part hswomen_part 
{res}{txt}
{com}. save "hswmeans_1992-2015CN.dta", replace
{txt}(note: file hswmeans_1992-2015CN.dta not found)
file hswmeans_1992-2015CN.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_tempinv = tempinv m_part = parttime if hsyoung==1, by(year country)
{txt}
{com}. rename m_tempinv hsyoung_tempinv
{res}{txt}
{com}. rename m_part hsyoung_part 
{res}{txt}
{com}. save "hsymeans_1992-2015CN.dta", replace
{txt}(note: file hsymeans_1992-2015CN.dta not found)
file hsymeans_1992-2015CN.dta saved

{com}. 
. 
. use "means_1992-2015CN.dta", clear
{txt}
{com}. merge 1:1 year country using "hsmeans_1992-2015CN.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}              10
{txt}{col 9}from master{col 30}{res}              10{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}             362{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. merge 1:1 year country using "hswmeans_1992-2015CN.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}              10
{txt}{col 9}from master{col 30}{res}              10{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}             362{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge 
{txt}
{com}. merge 1:1 year country using "hsymeans_1992-2015CN.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}              10
{txt}{col 9}from master{col 30}{res}              10{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}             362{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. 
. save "allmeans_1992-2015CN.dta", replace
{txt}(note: file allmeans_1992-2015CN.dta not found)
file allmeans_1992-2015CN.dta saved

{com}. 
. encode country, gen(cnty_n)
{txt}
{com}. tsset year cnty_n
{res}{txt}{col 8}panel variable:  {res}year (unbalanced)
{txt}{col 9}time variable:  {res}{col 25}cnty_n, 1 to 16, but with gaps
{txt}{col 17}delta:  {res}1 unit
{txt}
{com}. 
. tssmooth ma smooth_part=m_part, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= m_part{p_end}
{txt}
{com}. tssmooth ma smooth_tempinv=m_tempinv, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= m_tempinv{p_end}
{txt}
{com}. tssmooth ma smooth_hspart=hs_part, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hs_part{p_end}
{txt}
{com}. tssmooth ma smooth_hstempinv=hs_tempinv, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hs_tempinv{p_end}
{txt}
{com}. tssmooth ma smooth_hswomenpart=hswomen_part, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hswomen_part{p_end}
{txt}
{com}. tssmooth ma smooth_hswomentempinv=hswomen_tempinv, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hswomen_tempinv{p_end}
{txt}
{com}. tssmooth ma smooth_hsyoungpart=hsyoung_part, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hsyoung_part{p_end}
{txt}
{com}. tssmooth ma smooth_hsyoungtempinv=hsyoung_tempinv, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hsyoung_tempinv{p_end}
{txt}
{com}. 
. gen part =smooth_part*100
{txt}
{com}. gen hspart =smooth_hspart*100
{txt}
{com}. gen hswomenpart =smooth_hswomenpart*100
{txt}
{com}. gen hsyoungpart =smooth_hsyoungpart*100
{txt}
{com}. gen temp =smooth_temp*100
{txt}
{com}. gen hstemp =smooth_hstemp*100
{txt}
{com}. gen hswomentemp =smooth_hswomentemp*100
{txt}
{com}. gen hsyoungtemp =smooth_hsyoungtemp*100
{txt}
{com}. 
. 
. la var part "Workforce"
{txt}
{com}. la var temp "Workforce"
{txt}
{com}. la var hspart "High-skilled"
{txt}
{com}. la var hstemp "High-skilled"
{txt}
{com}. la var hswomenpart "High-skilled women"
{txt}
{com}. la var hswomentemp "High-skilled women"
{txt}
{com}. la var hsyoungpart "High-skilled young adults"
{txt}
{com}. la var hsyoungtemp "High-skilled young adults"
{txt}
{com}. 
. 
. 
. 
. twoway line part year  || ///
>                 line hsyoungpart year  || ///
>                 line hswomenpart year  ||, by(country, title(Part-time employment, size(medium))) ///
>                 legend( size(small) margin(zero) region(lpattern(blank)) bmargin(tiny) pos(6) row(2)) ///
>                 ytitle("% of total employment", size(medsmall) margin(zero)) ylabel(0(10)30, labsize(medsmall)) /// 
>                 title("") xtitle("") xlabel(1990(10)2015, labsize(medsmall)) saving(partCN, replace) ///
>                 graphregion(fcolor(white)) scheme(lean2) aspectratio(0.7)
{txt}(note: scheme lean2 not found, using s2color)
{res}{txt}(note: file partCN.gph not found)
{res}{txt}(file partCN.gph saved)

{com}. graph export "FIG_A2_PART_CN.eps", as(eps) replace
{txt}(note: file FIG_A2_PART_CN.eps not found)
(file FIG_A2_PART_CN.eps written in EPS format)

{com}. 
.                 
. twoway line temp year  || ///
>                 line hsyoungtemp year  || ///
>                 line hswomentemp year  ||,  by(country, title(Temporary employment, size(medium))) ///
>                 legend( size(small) margin(zero) region(lpattern(blank)) bmargin(tiny) pos(6) row(2)) ///
>                 ytitle("% of total employment", size(medsmall) margin(zero)) ylabel(0(10)30, labsize(medsmall)) /// 
>                 title("") xtitle("") xlabel(1990(10)2015, labsize(medsmall))saving(tempCN, replace) ///
>                 graphregion(fcolor(white)) scheme(lean2) aspectratio(0.7)
{txt}(note: scheme lean2 not found, using s2color)
{res}{txt}(note: file tempCN.gph not found)
{res}{txt}(file tempCN.gph saved)

{com}. graph export "FIG_A3_TEMP_CN.eps", as(eps) replace
{txt}(note: file FIG_A3_TEMP_CN.eps not found)
(file FIG_A3_TEMP_CN.eps written in EPS format)

{com}.                 
. save "allmeans_1992-2015CN.dta", replace
{txt}file allmeans_1992-2015CN.dta saved

{com}. 
. 
. *** Figure A.4: The spread of unemployment risks to the middle class, per country
. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_unempl = unempl       , by(year country) 
{txt}
{com}. save "umeans_1992-2015CN.dta", replace
{txt}(note: file umeans_1992-2015CN.dta not found)
file umeans_1992-2015CN.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_unempl = unempl if education ==3, by(year country)
{txt}
{com}. rename m_unempl hs_unempl
{res}{txt}
{com}. save "uhsmeans_1992-2015CN.dta", replace
{txt}(note: file uhsmeans_1992-2015CN.dta not found)
file uhsmeans_1992-2015CN.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse(mean) m_unempl = unempl if hswomen==1, by(year country)
{txt}
{com}. rename m_unempl hswomen_unempl
{res}{txt}
{com}. save "uhswmeans_1992-2015CN.dta", replace
{txt}(note: file uhswmeans_1992-2015CN.dta not found)
file uhswmeans_1992-2015CN.dta saved

{com}. 
. use "LSF_1992-2015_rec.dta", clear
{txt}
{com}. collapse (mean) m_unempl = unempl if hsyoung==1, by(year country)
{txt}
{com}. rename m_unempl hsyoung_unempl
{res}{txt}
{com}. save "uhsymeans_1992-2015CN.dta", replace
{txt}(note: file uhsymeans_1992-2015CN.dta not found)
file uhsymeans_1992-2015CN.dta saved

{com}. 
. 
. use "umeans_1992-2015CN.dta", clear
{txt}
{com}. 
. merge 1:1 year country using "uhsmeans_1992-2015CN.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}              10
{txt}{col 9}from master{col 30}{res}              10{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}             362{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. merge 1:1 year country using "uhswmeans_1992-2015CN.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}              10
{txt}{col 9}from master{col 30}{res}              10{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}             362{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge 
{txt}
{com}. merge 1:1 year country using "uhsymeans_1992-2015CN.dta"
{res}
{txt}{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}              10
{txt}{col 9}from master{col 30}{res}              10{txt}  (_merge==1)
{col 9}from using{col 30}{res}               0{txt}  (_merge==2)

{col 5}matched{col 30}{res}             362{txt}  (_merge==3)
{col 5}{hline 41}

{com}. drop _merge
{txt}
{com}. 
. save "UNallmeans_1992-2015CN.dta", replace
{txt}(note: file UNallmeans_1992-2015CN.dta not found)
file UNallmeans_1992-2015CN.dta saved

{com}. 
. encode country, gen(cnty_n)
{txt}
{com}. 
. tsset year cnty_n
{res}{txt}{col 8}panel variable:  {res}year (unbalanced)
{txt}{col 9}time variable:  {res}{col 25}cnty_n, 1 to 16, but with gaps
{txt}{col 17}delta:  {res}1 unit
{txt}
{com}. tssmooth ma smooth_unempl=m_unempl, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= m_unempl{p_end}
{txt}
{com}. tssmooth ma smooth_hsunempl=hs_unempl, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hs_unempl{p_end}
{txt}
{com}. tssmooth ma smooth_hswomenunempl=hswomen_unempl, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hswomen_unempl{p_end}
{txt}
{com}. tssmooth ma smooth_hsyoungunempl=hsyoung_unempl, window(2 1 3)
{txt}The smoother applied was
{res}{p 5 5 5} by year : (1/6)*[x(t-2) + x(t-1) + 1*x(t) + x(t+1) + x(t+2) + x(t+3)]; x(t)= hsyoung_unempl{p_end}
{txt}
{com}. 
. gen unempl =smooth_unempl*100
{txt}
{com}. gen hsunempl =smooth_hsunempl*100
{txt}
{com}. gen hswomenunempl =smooth_hswomenunempl*100
{txt}
{com}. gen hsyoungunempl =smooth_hsyoungunempl*100
{txt}
{com}. 
. la var unempl "Workforce"
{txt}
{com}. la var hsunempl "High-skilled"
{txt}
{com}. la var hswomenunempl "High-skilled women"
{txt}
{com}. la var hsyoungunempl "High-skilled young adults"
{txt}
{com}. 
. twoway line unempl year  || ///
>                 line hsyoungunempl year  || ///
>                 line hswomenunempl year  ||, by(country, title(Unemployment, size(medium)))  ///
>                 legend( size(small) margin(zero) region(lpattern(blank))  pos(3) row(2)) ///
>                 ytitle("% of total employment", size(small) margin(zero)) ylabel(0(5)15, labsize(small)) /// 
>                 title("") xtitle("") xlabel(1990(10)2020, labsize(small))  ///
>                 graphregion(fcolor(white)) scheme(lean2) aspectratio(0.9)
{txt}(note: scheme lean2 not found, using s2color)
{res}{txt}
{com}.         
. graph export "FIG_A4_spread in the MC_UNEMPL_CN.eps", as(eps) replace
{txt}(note: file FIG_A4_spread in the MC_UNEMPL_CN.eps not found)
(file FIG_A4_spread in the MC_UNEMPL_CN.eps written in EPS format)

{com}.                 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}G:\My Drive\Replications\Schwander\Log_Analysis_Schwander_PSRM.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}22 Feb 2019, 10:38:23
{txt}{.-}
{smcl}
{txt}{sf}{ul off}